using System.Data.Linq;
using System;

namespace RomanJendrusz.Amazon.ETL.Domain
{
    public class ListItem
    {
        private EntityRef<Book> book;
        private EntityRef<ListMania> listMania;
        private string listId;
        private string bookAsin;
        private DateTime updated;

        public ListItem()
        {
            book = new EntityRef<Book>();
        }

        public string ListItemId { get; set; }
        public DateTime? DateAdded { get; set; }
        public int? QuantityDesired { get; set; }
        public int? QuantityReceived { get; set; }
        /// <summary>
        /// Gets or sets the row updated.
        /// </summary>
        /// <value>The row updated.</value>
        public DateTime Updated
        {
            get { return updated; }
        }

        public ListMania List
        {
            get { return listMania.Entity; }
            set
            {
                listMania.Entity = value;
                listId = value.ListId;
            }
        }

        public Book Book
        {
            get { return book.Entity; }
            set 
            {
                if (value == null) throw new ArgumentNullException("value");
                book.Entity = value;
                bookAsin = value.Asin;
     
            }
        }
    }
}